/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.Components;

import General.CurrentData;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

/**
 *
 * @author David
 */
public class InsertVectorMouseListener implements MouseListener
{

    private Float3Panel float3Panel;
    private JPopupMenu popupMenu = new JPopupMenu();
    private JMenuItem insertCameraLocationItem = new JMenuItem("Camera Location");
    private JMenuItem insertCameraDirectionItem = new JMenuItem("Camera Direction");

    /**
     *
     * @param f3p
     */
    public InsertVectorMouseListener(Float3Panel f3p)
    {
        float3Panel = f3p;
        popupMenu.add(insertCameraLocationItem);
        popupMenu.add(insertCameraDirectionItem);
        insertCameraLocationItem.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                float3Panel.setManualUserChangeMade(true);
                float3Panel.setVector(CurrentData.getEditorWindow().getB3DApplication().getCamera().getLocation());
            }
        });
        insertCameraDirectionItem.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                float3Panel.setManualUserChangeMade(true);
                float3Panel.setVector(CurrentData.getEditorWindow().getB3DApplication().getCamera().getDirection());
            }
        });
    }

    public void mouseClicked(MouseEvent e)
    {
    }

    public void mousePressed(MouseEvent e)
    {
    }

    public void mouseReleased(MouseEvent e)
    {
        if (e.getButton() == MouseEvent.BUTTON3)
        {
            popupMenu.show(float3Panel, e.getX(), e.getY());
        }
    }

    public void mouseEntered(MouseEvent e)
    {
    }

    public void mouseExited(MouseEvent e)
    {
    }
}
